import Vue from 'vue'
import App from './App'

import api from "API/index.js"
import util from "@/utils/index.js"
import i18n from '@/locale/index.js';
// #ifdef H5
import jweixin from "@/utils/jweixin.js"
// #endif
import store from "@/store/index.js"
import banner from '@/components/banner.vue'
import column from '@/components/column.vue'
import fixed from '@/components/fixed.vue'
import search from '@/components/search.vue'
import auth from '@/components/auth.vue'
import tab from '@/components/tab.vue'
import abnor from '@/components/abnor.vue'
import loadMore from '@/components/load-more.vue'
import upload from '@/components/upload.vue'
import minCountdown from '@/components/min-countdown.vue'
import uniNavBar from '@/components/uni-nav-bar.vue'
import uniPopup from '@/components/uni-popup.vue'
import commonPopup from "@/components/common-popup.vue"
import loginInfo from "@/components/login-info.vue"
import fixBottomButton from "@/components/fix-bottom-button.vue"
import uniSegmentedControl from "@/components/uni-segmented-control.vue"
import back from "@/components/back.vue"
import func from '@/node_modules/uview-ui/func.js'
// import wx from 'https://res.wx.qq.com/open/js/jweixin-1.2.0.js'
 
// Vue.prototype.$wx = wx
import { addPermisionInterceptor } from '@/uni_modules/x-perm-apply-instr/js_sdk/index.js'
addPermisionInterceptor('chooseImage', '为了修改个人头像和发布信息图片视频等, 我们需要申请您设备的相机和存储权限')
addPermisionInterceptor('chooseVideo', '为了发布信息图片视频等, 我们需要申请您设备的相机和存储权限')
addPermisionInterceptor('saveImageToPhotosAlbum', '为了保存推广海报到手机相册, 我们需要申请您设备的存储权限')
addPermisionInterceptor('getLocation', '为了根据您的位置展示信息, 我们需要申请您设备的位置权限')
addPermisionInterceptor('makePhoneCall', '为了联系客服/用户/咨询等, 我们需要申请您设备的拨打电话权限')
addPermisionInterceptor('getRecorderManager', '为了使用语言消息功能等, 我们需要申请您设备的麦克风权限')

Vue.component('banner', banner)
Vue.component('column', column)
Vue.component('fixed', fixed)
Vue.component('search', search)
Vue.component('auth', auth)
Vue.component('tab', tab)
Vue.component('abnor', abnor)
Vue.component('loadMore', loadMore)
Vue.component('upload', upload)
Vue.component('minCountdown', minCountdown)
Vue.component('uniNavBar', uniNavBar)
Vue.component('uniPopup', uniPopup)
Vue.component('commonPopup', commonPopup)
Vue.component('loginInfo', loginInfo)
Vue.component('fixBottomButton', fixBottomButton)
Vue.component('uniSegmentedControl', uniSegmentedControl)
Vue.component('back', back)
Vue.use(func);

Vue.prototype.$api = api
Vue.prototype.$util = util
Vue.prototype._i18n = i18n;
// #ifdef H5
Vue.prototype.$jweixin = jweixin
// #endif
Vue.config.productionTip = false
import uView from "uview-ui";
Vue.use(uView);
import httpInterceptor from '@/common/http.interceptor.js'
Vue.use(httpInterceptor, app);
App.mpType = 'app'
uni.$store = store
uni.$api = api
uni.$util = util


/**
 * 图片的路径
 */
Vue.prototype.imageURL = "../../../static/static/"; //本地路径
// Vue.prototype.imageURL = "https://"; //网络路径
Vue.prototype.getImageURL = function (url) {
	return Vue.prototype.imageURL + url;
};
/**
 * 导航栏
 */
import navigationBar from "@/components/components/navigationBar/navigationBar.vue";
Vue.component("navigationBar", navigationBar);
/**
 * 主色
 */
Vue.prototype.$themeColor = "#606DCE";

/**
 * js方法
 */
import filter from "@/utils/utils/filters.js";
Vue.prototype.$filters = filter;

/**
 * 点击事件 参数带 handle 回调方法的
 */
Vue.prototype.$handle = function(item) {
	return item.handle(item)
}

/**
 * 导航栏的总高度
 */
// #ifdef H5
Vue.prototype.$navigationHeight = 0;
// #endif

/**
 * 没有数据的空白占位
 */
import uEmpty from "@/components/components/emptyData/emptyData.vue";
Vue.component("uEmpty", uEmpty);

Vue.component("emptyData", uEmpty);
/**
 * 底部按钮
 */
import wrapFooter from "@/components/components/footer/footer.vue";
Vue.component("wrapFooter", wrapFooter);

/**
 * 吐司
 */
import st from "@/utils/showtoast.js";
Vue.prototype.$st = st;
/**
 * 存储的信息
 */
import stoarge from "@/utils/utils/stoarge.js";
Vue.prototype.$stoarge = stoarge;

Vue.prototype.$imageURL = 'https://apishop.qiancdj.com/api/';

import * as filters from "@/utils/utils/filters";
// 添加全局filter
Object.keys(filters).forEach((key) => {
	Vue.filter(key, filters[key]);
});
// 弹窗
import totalMask from "@/components/totalMask/totalMask.vue";
Vue.component("totalMask", totalMask)

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App,
	store,
	i18n
})
app.$mount()
// @import "@/styles/index.wxss";